package com.ydd.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ydd.entity.SysMenu;
import com.ydd.vo.MenuVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface MenuMapper extends BaseMapper<SysMenu> {
    /**
     * 获取所有菜单
     * @return
     */
    @Select("select * from sys_menu where type=1 ")
    List<SysMenu> all();

    /**
     * 更新菜单
     * @param sysMenu
     */
    void update(SysMenu sysMenu);

    /**
     * 根据id删除
     * @param id
     */
    @Delete("delete from sys_menu where id=#{id}")
    void del(Integer id);

    /**
     * 添加数据
     * @param sysMenu
     */
    void add(SysMenu sysMenu);


    @Select("select * from sys_menu where id=#{id}")
    SysMenu selectById(Integer id);

    /**
     * 获取所有数据
     * @return
     */
    @Select("select * from sys_menu")
    List<SysMenu> allData();
}